1. /* sfmststr.cpp by K.Tsuru */
  2. // function ID = 702 DRADIX
  3. /*****************************
  4. SFraction class
  5. It sets a value by string.
  6. *****************************/
  7. #ifndef SN_H
  8. #include "sn.h"
  9. #endif
  10. void SFraction::SetString(const char *s){
  11. char* buff = new char[strlen(s)+1];
  12. int slash;
  13. char* pt = buff;
  14. while( (*s != '/') && *s ) *(pt++) = *(s++); //copy the numerator
  15. slash = (*s == '/') ? 1 : 0;
  16. *pt = '\0';
  17. //It substitutes to SLong by string.
  18. num = buff;
  19. if(slash == 0){ //There is no '/'.
  20. den = 1.0; reduceDone = true;
  21. } else {
  22. s++; den = s;
  23. reduceDone = false;
  24. DenCheck();
  25. #if REDUCE_SIZE != 0
  26. reduce(false);
  27. #else
  28. reduce();
  29. #endif
  30. }
  31. delete[] buff;
  32. }

sfmststr.cpp : last modifiled at 2017/10/23 11:00:11(722 bytes)
created at 2015/12/22 16:07:29
The creation time of this html file is 2017/10/23 11:26:54 (Mon Oct 23 11:26:54 2017).